package com.kaisa.activity.ui;

import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;

import com.kaisa.activity.R;
import com.kaisa.activity.adapter.ViewAdapter;

import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 123 on 2015/12/16.
 */

public class ProduceActivity extends AppCompatActivity {
    @ViewInject(R.id.produce_vp)
    private ViewPager viewPager;
    private ViewAdapter adapter;
    private List<ImageView> bitmaps = new ArrayList<ImageView>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.produce_activity_main);
        x.view().inject(this);
        Intent intent = getIntent();
        int id = intent.getIntExtra("id",0);
        initView();
        initData();
    }

    private void initData() {
        ImageView imageView = new ImageView(this);
        x.image().bind(imageView,"http://img.caissa.com.cn/201108/201108111444521557219.jpg");
        bitmaps.add(imageView);
        adapter.notifyDataSetChanged();
    }

    private void initView() {
        adapter = new ViewAdapter(bitmaps);
        viewPager.setAdapter(adapter);
    }
}
